<?php


namespace app\common\business;


use app\common\model\AdminUser;

class AdminUserBusiness
{
    private $adminUserModel;
    private $salt = '';
    public function __construct()
    {
        $this->adminUserModel = new AdminUser();
    }

    public function findUserByName($name)
    {
        if (empty($name))
        {
            return null;
        }
        return $this->adminUserModel->findByUsername($name);
    }

    public function authenticate($password, $user)
    {
        $auth_password = md5($password.$this->salt);
        return $auth_password == $user['password'];
    }

}